modified example.py, see details in a comment of this issue