make code compatitable with python 2.6