more robust fix for empty $data->payload