fixed double precision errors