Fixed version.py to work correctly in case of error