Fix preferences bugs