Fixed some issues in triggers.