It sometimes calculates 'incorrectly' on purpose.
The % risk trade sizing code does have undocumented but apparently intentional situations where it violates the user's selected setting and trades above the stated percentage. (A somewhat dangerous prospect.)
Perhaps that is involved in this problem.
Would be nice if such things were documented and/or user selectable.