WIP: only replace var for clauses that are executed