fixes for OS X and permissions