changed plugin handling, fixed some minor bugs