Improved version autodetection on upgrading procedure