bug #3154: Fix issues when the template contains single quotes