Added a global lock