Fixed bug where response was not being captured for errors