adjusting some plugin code