get and use both legacy and new version numbers

o.k. this should do it - untested, late on Friday code, I'm afraid. I tested the SQL, not the python.