various cleanups, osx adaptation