improved Python3 support