dmg given calculation fix