added support for locking