added debug support for both output window and console