fixed saving bug thowing io exception