Some fixes for py3