diff --git a/src/ai.c b/src/ai.c
index ecdfa00..ee772f2 100644
--- a/src/ai.c
+++ b/src/ai.c
@@ -271,8 +271,8 @@ static int ai_loadProfile(char* filename) {
 
   L = profiles[nprofiles-1].L;
 
-  /* Open the standard Lua libraries. */
-  /*luaL_openlibs(L); */
+  /* Open basic Lua stuff. */
+  llua_loadBasic(L);
 
   /* Constants. */
   lua_regnumber(L, "player", PLAYER_ID); /* Player id. */
@@ -365,7 +365,8 @@ void ai_attacked(Pilot* attacked, const unsigned int attacker) {
   L = cur_pilot->ai->L;
   lua_getglobal(L, "attacked");
   lua_pushnumber(L, attacker);
-  lua_pcall(L, 1, 0, 0);
+  if(lua_pcall(L, 1, 0, 0))
+    WARN("Pilot '%s' ai -> 'attacked' : %s", cur_pilot->name, lua_tostring(L, -1));
 }
 
 /* Pilot was just created. */