fix possible deadlock in panic