AutoReleasePool creation where required on Mac OS X and other minor corrections.