fixing javascript form behavior