fixed bugs in plugin