changes for compatibility with py3 branch