fix a bug in the set method