Fixed encoding issues when writing to files