moved check to prevent multiple submits (again)