Fix setTag to avoid memory leak