add exception handling for bad responses