added basic support for debug mode.