Fixing bug in recognizing special reorderings