Added locking bugfix