Avoid error when using Mongoid with threads