plurality function bug fix