fixed range command to remove subsequent pop()