emit order fix and corresponding test and test fixes.