Upload as new file: Fix wrong insertion of template