Added thread_safe version from github (travis-ci didnt find the correct one).