fix parent scope for xtemplate. Fixes #356.