fixed a bug where the program would crash if a directory was not specified