python 2.x compatibility fix