Fix bugs on triggers