Added more robust way to achieve save file IO