fixed creation of output file and data directory