fixing a bug in remove tags