improve server error handling