update compare fuction