fix counting of tags in DB