fix incorrect mod rounding
Merge pull request #8831 from simonbyrne/mod-fix2

fix incorrect mod rounding