refactor for py3.4