Improved the switching for debug mode.