Fixes for Mac OS X:
better now, but still doesn't work correctly
Improve logs