make server code more resilient