fixed another issue with save function