Implementing patch #2341611 for entity module

DON't get this IN YET