fixed so entities not overflowing MAX_ENTITIES