fixes for py3. there'll probably be more to come