Fixed minor bug to saving files