move tag removal to the right place