fixed bug with saving files