Setting maximum temperature only works above 0 degrees

I don't know if this is the problem, it just looked strange to me.

flow.set("tempmin", temp) sets flow.tempmin. It doesn't set the var tempmin.

Contrariwise, I think

var tempmin = flow.get('tempmin')
tempmin = 55

does set flow.tempmin to 55.
Not good programming style to rely on it though