fixed minor bug in implementation so that we correctly output the missing values