Fix bug #15. Segfault when using concurrently.

Fix for segfault. Tested with heavy load in sidekiq with 25 threads.