Fix bug in deleting plugins