Dir handling

Improved robustness for reading the source directory. Didn't work
before, unless the directory was '.' (the default).
Various small changes