Fixes for Py2.6 compatibility