fix sort (need refacto)