Add error cases, make networking more stable