Modified sql.py.