fix bugs of sessionmaker