Locking bugfixes.