fixed error in sorting by number