fixed bugs on update and save