bug fix functions.py