Fixed bug with saving file