py2 & 3 compatibility changes.