Use filekey for output file. Print err to file