fix some bugs improve logging of bad matches
show some missing ends