fixed exception being thrown when undoing last selection