Fix errors in plugins migrations

When migrations was rewritten, some error slipped in the code.
Even if the plugins are going away, they should be sane for the time left.
Bckport of #2037