fix bugs in plugin