Fixed NPE when retrieving control names

Fixed NPE when retrieving control names according to entity types.