BUG : fixed py3k compat issues

 - used xrange instead of range, but importing range from six.moves
   so should really be xrange in py2