now deals with missing values