Fix error handling all requests, because data is not always valid JSON