add plan debugging code