Fixes for g++ 4.7 and OS X