fix if-then traversal