CONTRIB-5266 Fixing invalid upgrade code