fixed error handling so debug will always print output response