prevent infinite submit loop when page reloads