Fix potential freeze in debugger mode