Why isn't my form calculating properly?