fix some calculation errors