Make runsql more resilient.