added global lock