Bugfix: generated entity equals incorrect

Fix #402