Fixes for Save and SaveAs

This commit hopefully fixes all the save and SaveAs problems.