write and read history to file works