catching connection errors and re-trying later