Fix typo in calculating D