Fix bug in DG calculation.