made changes for compat with py3