Another fix to layer name replacement. Closes #54