Fix the dp matrix bug.