added deepcopy of data for the apicall