DB/Misc: Fix some runtime errors/incorrect triggers

By dr-j