fix bugs when samples input with false order