Fixed Bug: results not saved to output file.