Improved python3 compatibility of last commit.