fix kwtest

Fixes printing of ternary `if` when elements contain keywords, and some
other minor bugs