Fixed incorrect detection of empty tags