Corrected isExpression for templates.

Fixes #1046.