fixes for py3 compatiblity