Debug: fix for infinite loop handling exceptions