DB/SAI: Fix several runtime warnings / logical mistakes

* Wrong event types for linked events
* Possible multiple AI template initialization