Fix copyPlugin function.