fix crash on incomplete tag
add test for incomplete tags