clean up the dirty flag correctly in Entity.prototype.resolve