tagging functions and bugfixes