Fixed problem with saving preferences