fix small bug on creating entities