fixing bug in sorting