MDL-13811 reworked unsetting of preferences and minor tweaks