Fixed bug with write_schema_file not being saved correctly