hardened $TEMPLATE submissions
fixes #847