Fix #979 by querying trigger types only once and storing them