Improved error handling for network errors

Fixes #133