Corrected bug in finding highest occurence index