fix delete logic after plugin refactoring

see c4f01fa50a40ab6624c84aeb9d1d9746f45f4118

props francescolaffi