Fixed ordering bugs