Threading issue with MacOSX 10.8

Hi
This should solve #298 on MacOSX 10.8. I didn't tested 10.7/6 or iOS.