Why does my form not work consistently