Fix compile issues for OSX