fixed bugs in update/save/retract/retract-entities