add reduce import for Py3
fix integer types for Py3
fix string types for Py3