Remove dead code from tests.
Remove unnecessary locks.