Fix disconnect and save bug