fixed a bug the occurred when the entity manager array is empty