Some places should use RLock instead of Lock (ref #169)