Need to clone filemap instead of copying reference or we fuck up our originals
Fixed bugs when editing non-leaf templates