fixed bug with ordering