Fixing some Python 2 bugs.