Python3 bug fixes.

Change-Id: I7f6b4b59a5e9f4ce058f654f13ef9ce57805fee5