Fixed a floating number issue that rarely occured. Now BigDecimals are
used for critical calculations.