fix error handling when api has not return json