diff --git a/scripts/ai/collective.lua b/scripts/ai/collective.lua
index becada8..c793d06 100644
--- a/scripts/ai/collective.lua
+++ b/scripts/ai/collective.lua
@@ -4,7 +4,7 @@ include("../scripts/ai/include/basic.lua")
 control_rate = 2
 
 function control()
- if ai.taskname() == "none" then
+ if ai.taskname() == nil then
   enemy = ai.getenemy()
 
   if enemey ~= 0 then
diff --git a/scripts/ai/empire.lua b/scripts/ai/empire.lua
index 90331be..d72a8ed 100644
--- a/scripts/ai/empire.lua
+++ b/scripts/ai/empire.lua
@@ -8,7 +8,7 @@ function control()
  task = ai.taskname()
 
  enemy = ai.getenemy()
- if task ~= "attack" and enemy ~= 0 then
+ if task ~= "attack" and enemy ~= nil then
    ai.hostile(enemy)
   ai.pushtask(0, "attack", enemy)
  elseif task == "none" then
diff --git a/scripts/ai/militia.lua b/scripts/ai/militia.lua
index b18274c..357ac80 100644
--- a/scripts/ai/militia.lua
+++ b/scripts/ai/militia.lua
@@ -8,7 +8,7 @@ function control()
  task = ai.taskname()
 
  enemy = ai.getenemy()
- if task ~= "attack" and enemy ~= 0 then
+ if task ~= "attack" and enemy ~= nil then
    ai.hostile(enemy)
   ai.pushtask(0, "attack", enemy)
  elseif ai.taskname() == "none" then