diff --git a/blog/lib.php b/blog/lib.php
index 735b0336a0c..5a8ba603a26 100755
--- a/blog/lib.php
+++ b/blog/lib.php
@@ -227,7 +227,7 @@
WHERE t.id = ti.tagid
AND ti.entryid = '.$blogEntry->id)) {
*/
- if (!empty($CFG->usetags) && ($blogtags = get_item_tags('blog', $blogEntry->id))) {
+ if (!empty($CFG->usetags) && ($blogtags = get_item_tags('post', $blogEntry->id))) {
echo '
';
if ($blogtags) {
print_string('tags');
diff --git a/tag/lib.php b/tag/lib.php
index 272e158f08f..788c49e25a5 100644
--- a/tag/lib.php
+++ b/tag/lib.php
@@ -907,7 +907,7 @@ function tag_instance_table_cleanup() {
FROM
(SELECT sq2.*
FROM {$CFG->prefix}tag_instance sq2
- LEFT JOIN {$CFG->prefix}tag item
+ LEFT JOIN {$CFG->prefix}{$type->itemtype} item
ON sq2.itemid = item.id
WHERE item.id IS NULL
AND sq2.itemtype = '{$type->itemtype}')