handling degenerate cases