Fixed bug in setting order