moved settlement queries on session.query