fix to work with older versions of python3