Fixes template handling during style export

Fixes #1595