spot : fiw memory leak and avoid rounding error