added rounding for floating point problems