optparse: fix various edge-case bugs.