Fixed code upgrade for versions below 4.0.1.