fixed bug with trying to update nonexistent entity