Reentrant locking bug fixes.