Python 3 compatibility
Fixed adaptation for 3.* Python ver.