Fixed issue #8345: Copy template caused an error