error handling in processJSON