Various fixes to resolve issues with building python modules on OSX