Fix a bug in the set function.