Added RichardSU's fix for Mac OSX

May work for others