CHANGED: Core - Using define for checking invalid entity ids.