fix decimal calculation bug and null value bug