small bug
fixed bug in order algorithm