added needed changes to be able to compile on MacOSX