modified lib.py