fixed some saving bugs