fix various issues on osx