python 3 fixes for #29