Fix serialization of preferences