fixed bug with api calls where error results were double json encoded