Python 2.x support

Small changes to run under Python 2.x