BUG: outfn was being overwritten