Fixed crashes in AiRelations