Submit Button not working and sometimes (but not always) shows errors