Found bug in sorting