error if optlen not what we expected - see #141 - add diagnostics