Fix a crash when creating two entities with the same name. Fix #370.

Entity names are now auto-incremented for convenience.