updated so error and output files go in right place