Fix save logic