bug fix on Python sequence generator