Output to file, fixes