more fixes to work on mac osx