Write instead of modify version files

and better missing version detection