Fix setTag to avoid memory leak (candidate 2)