Fix py2.6 and 3+