Fixed bug where document could not save when requested. Modernized some non-ARC code.