OS X compilation fixes