fixed multiple set and reset issue