fix bug on db.py