handle JSON parse error as well