fixing bugs in staircase-categorize