Fixed a coding error in the OSX script, and made the OSX script resistant to network failures on suspend and resume.