add compatibility for py3 support