fix and add support for python3