Fixed several problems in the DB triggers.
Fixed some triggers.
More triggers fixes.