Bug fixes in ordering process (hope it's not a deeper bug)