fix filling in missing values loop