Fix issues with saving and restoring settings