Null check on detecing entities