replace xrange with range for py3 compat