Adding fixes for running tests in python 2.6 and python 3.2