Fixing small glitches on submit function