Add more debug info when dynamic programming