sort function returns zero for same values