Add test for upgrade and fix upgrade plugin