Eliminate infinite loop in debug mode