OS X compatibility fixes