Why calculations in my form are not working properly?