Make version lookup logic more robust.