Fixed a bug that would cause the entity arrays to fill with undefined members when the local state was cleared