Better check existing fields when generating an entity

Fix #658