Fixing bug in step reordering.