Fixed a bug when using Python3.