OS X Compatibility fixes