updated error handling for situations with bad connections or null response