improved python 3 support