fix erroneous arithmetic