small fix in sorting