Trying to fix zbeacon in OSX

I faced a problem similar to issue #532. This modifications solved the problem for me. I also added some traces to the error console to aid identification of future issues.