Fix exception when creating polymer template

@devoncarew

Fixes #2946.