Fixed abug with null entity.