fixing length bug in staircase-categorize