Fix popular count query.