fixed errors with saving