fix plugin save logic