Fixed bug in remove tags

This function is a pain in the ass.