Fixed errors when reloading plugin.