Fix processing of --base-dir and --output-dir options (work in progress)
(+ more tests added)