Fix popularity calculation