fix plugin bug on cancel, closes #398