added extra check for data content and status_code