write outputs to files for convenience