Fix dynamic programming table creation