add compatibility for python3