Fixes for OSX/Windows