update and bugfiz of tri* classes