add debug mechanism