Fixed errors in plugin system