Some adjustments to the way debug mode is set.