Fix saving to file