Changes to work with Mac OS X

Made a few changes to make it work with Mac OS X