fixes range compatibility for python3