#36: fix sorting bug