Added some tests and fixes around option processing