added function to deal with missing value