added dbg mode