tags handling - function not working