fix a bug: sort in plaace