More reliable onsubmit