Copy layer instead of referring to it

Making an explicit copy prevents getting the wrong layer name.