works for qsort (modify atoms order)