Improved handling of old Python