fix a bug of changing dictionary