fix command line parsing and paths for external files
Exits with code 1 when there are errors