fixing the old-ass error handling and autorecover from socket burps