added code to prevent unneeded saves