Network error handling and retry; bugfixes