handle network errors

Closes #62