added function to replace missing data