Fix test script for python 3.X

Fix test script to work also with python 3.X