Add some more locking to prevent crash on reset.