fix bugs in order