fixed roundoff errors