Fixed bug in util.py