Fixing some plugin code