another try to make it more python 3 compatible