improved plugin handling