fixed the session expired bug in sqlalchemy