sort out stagenum