Fix to preserve template permissions and ownership