various fixes for OS X 10.8 build