discovered my outdir variable was in the wrong scope