Fix linking issues on Mac OS X