Fixed error with variables written to files.