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.
Backport to 2.4 of #2037