Fixed bug with ordering