small modifications to allow compiling and running on Mac OSX [tested in Mavericks]