Fixes for py3 compat