fix several bugs related to plugin refactoring