Fix minor bug in ordering