fixed updateData function