Fix bug in trail stepnumber ordering