Fix copyPlugin function.

Thanks to @yakky for the support.