Improved python3 support