Fix settings save function