Make MessageManager thread safe