fix unneeded global var
fix precision error