Added checks for console in debug mode.