Fix file opening from command line arguments