improved plugin activation code