Fix settings save and restore