fix add-then-set-type bug