adding ability to flatten errors response