Fix for relative pathnames and some additional checks on command line arguments