fixing the usage of boost::mutex::scoped_lock