null pointer check for popularity added