added check for empty tags