diff --git a/server-tools/instance-manager/buffer.cc b/server-tools/instance-manager/buffer.cc
index 7e785f0450e315a7c0a981265df70a691d15e931..ca84adbfd10676ed41102892cf113a917c3086ae 100644
--- a/server-tools/instance-manager/buffer.cc
+++ b/server-tools/instance-manager/buffer.cc
@@ -85,7 +85,7 @@ int Buffer::reserve(uint position, uint len_arg)
                              min(MAX_BUFFER_SIZE,
                                  max((uint) (buffer_size*1.5),
                                      position + len_arg)));
-    if (buffer= NULL)
+    if (buffer == NULL)
       goto err;
     buffer_size= (uint) (buffer_size*1.5);
   }
diff --git a/server-tools/instance-manager/commands.cc b/server-tools/instance-manager/commands.cc
index 2ac97382aa812d9a8dcd3c3b59cb2c336b7ba2c7..207ec3183e6a0f8d46dfad7f50ebb6ec42b5d454 100644
--- a/server-tools/instance-manager/commands.cc
+++ b/server-tools/instance-manager/commands.cc
@@ -63,7 +63,7 @@ int Show_instances::do_command(struct st_net *net)
     Instance_map::Iterator iterator(instance_map);
 
     instance_map->lock();
-    while (instance= iterator.next())
+    while ((instance= iterator.next()))
     {
       position= 0;
       store_to_string(&send_buff, instance->options.instance_name, &position);
@@ -117,7 +117,7 @@ Show_instance_status::Show_instance_status(Instance_map *instance_map_arg,
   Instance *instance;
 
   /* we make a search here, since we don't want t store the name */
-  if (instance= instance_map->find(name, len))
+  if ((instance= instance_map->find(name, len)))
   {
     instance_name= instance->options.instance_name;
   }
@@ -222,7 +222,7 @@ Show_instance_options::Show_instance_options(Instance_map *instance_map_arg,
   Instance *instance;
 
   /* we make a search here, since we don't want t store the name */
-  if (instance= instance_map->find(name, len))
+  if ((instance= instance_map->find(name, len)))
   {
     instance_name= instance->options.instance_name;
   }
@@ -306,7 +306,7 @@ int Show_instance_options::do_command(struct st_net *net,
     }
 
     /* loop through the options stored in DYNAMIC_ARRAY */
-    for (int i= 0; i < instance->options.options_array.elements; i++)
+    for (uint i= 0; i < instance->options.options_array.elements; i++)
     {
       char *tmp_option, *option_value;
       get_dynamic(&(instance->options.options_array), (gptr) &tmp_option, i);
@@ -355,7 +355,7 @@ Start_instance::Start_instance(Instance_map *instance_map_arg,
   :Command(instance_map_arg)
 {
   /* we make a search here, since we don't want t store the name */
-  if (instance= instance_map->find(name, len))
+  if ((instance= instance_map->find(name, len)))
     instance_name= instance->options.instance_name;
 }
 
@@ -388,7 +388,7 @@ Stop_instance::Stop_instance(Instance_map *instance_map_arg,
   :Command(instance_map_arg)
 {
   /* we make a search here, since we don't want t store the name */
-  if (instance= instance_map->find(name, len))
+  if ((instance= instance_map->find(name, len)))
     instance_name= instance->options.instance_name;
 }
 
@@ -406,7 +406,7 @@ int Stop_instance::execute(struct st_net *net, ulong connection_id)
     if (instance->options.is_guarded != NULL)
         instance_map->guardian->
                stop_guard(instance);
-    if (err_code= instance->stop())
+    if ((err_code= instance->stop()))
       return err_code;
     printf("instance was stopped\n");
     net_send_ok(net, connection_id);
diff --git a/server-tools/instance-manager/guardian.cc b/server-tools/instance-manager/guardian.cc
index ac3e6298ea146f93de69b6f47da163b3dd8960f6..7375453673b91fd47530cf13a37e60f42d6dae41 100644
--- a/server-tools/instance-manager/guardian.cc
+++ b/server-tools/instance-manager/guardian.cc
@@ -110,7 +110,7 @@ int Guardian_thread::start()
   Instance_map::Iterator iterator(instance_map);
 
   instance_map->lock();
-  while (instance= iterator.next())
+  while ((instance= iterator.next()))
   {
     if ((instance->options.is_guarded != NULL) && (instance->is_running()))
       if (guard(instance))
diff --git a/server-tools/instance-manager/instance.cc b/server-tools/instance-manager/instance.cc
index 42909a134acbbbfebacdb0627a5ddbd09123c6fd..58bc5b85dd8441f068cd542741c6fd087ee7f7a5 100644
--- a/server-tools/instance-manager/instance.cc
+++ b/server-tools/instance-manager/instance.cc
@@ -88,8 +88,8 @@ Instance::~Instance()
 
 bool Instance::is_running()
 {
-  uint port;
-  const char *socket;
+  uint port= 0;
+  const char *socket= NULL;
 
   if (options.mysqld_port)
     port= atoi(strchr(options.mysqld_port, '=') + 1);
diff --git a/server-tools/instance-manager/instance_map.cc b/server-tools/instance-manager/instance_map.cc
index 355b51269d5753def8f16006afe8f834eeacbd10..9399d6e2563f372a8488364948b75d9b37ada484 100644
--- a/server-tools/instance-manager/instance_map.cc
+++ b/server-tools/instance-manager/instance_map.cc
@@ -203,9 +203,12 @@ int Instance_map::cleanup()
   while (i < hash.records)
   {
     instance= (Instance *) hash_element(&hash, i);
-    instance->cleanup();
+    if (instance->cleanup())
+			return 1;
     i++;
   }
+
+	return 0;
 }
 
 
@@ -250,7 +253,7 @@ Instance *Instance_map::Iterator::next()
 {
   if (current_instance < instance_map->hash.records)
     return (Instance *) hash_element(&instance_map->hash, current_instance++);
-  else
-    return NULL;
+
+  return NULL;
 }
 
diff --git a/server-tools/instance-manager/instance_map.h b/server-tools/instance-manager/instance_map.h
index e1bfe6ab391e80e3fcb959f6f62c050a7e2f7f90..522785ce9b98ae049c47f844f12bbb38a5096248 100644
--- a/server-tools/instance-manager/instance_map.h
+++ b/server-tools/instance-manager/instance_map.h
@@ -38,7 +38,6 @@ extern void free_groups(char **groups);
 
 class Instance_map
 {
-  friend class Iterator;
 public:
   /* Instance_map iterator */
   class Iterator
@@ -54,6 +53,7 @@ public:
     void go_to_first();
     Instance *next();
   };
+  friend class Iterator;
 public:
   /* returns a pointer to the instance or NULL, if there is no such instance */
   Instance *find(const char *name, uint name_len);