fixed crash bug with DBSession ids