Fixed some test for Python 3 compatibility