added log message and better tags handling