Fix issue in version_compare that can cause versions to be wrongly marked incompatible