Fix py3.3 compatibility with reduce function