Fix evaluating match expressions multiple times.

This closes ticket #135.