--- a/src/engine.c
+++ b/src/engine.c
@@ -151,7 +151,8 @@
 {
     array_release_context(array_context);    
 
-    g_object_unref(config);
+    if (g_object_is_floating (config))
+        g_object_unref(config);
     config = NULL;
 }
 
@@ -189,6 +190,7 @@
     arrayeng->space_press_count = 0;
 
     arrayeng->table = ibus_lookup_table_new (10, 0, FALSE, TRUE);
+    g_object_ref_sink (arrayeng->table);
     setup_label = ibus_text_new_from_string("Setup");
     setup_tooltip = ibus_text_new_from_string("Configure Array 30 engine");
     setup_prop = ibus_property_new("setup", 
@@ -197,12 +199,12 @@
                                     "gtk-preferences",
                                     setup_tooltip,
                                     TRUE, TRUE, 0, NULL);
-    g_object_unref(setup_label);
-    g_object_unref(setup_tooltip);
+    g_object_ref_sink (setup_prop);
 
     arrayeng->prop_list = ibus_prop_list_new();
+    g_object_ref_sink (arrayeng->prop_list);
+
     ibus_prop_list_append(arrayeng->prop_list, setup_prop);
-    g_object_unref(setup_prop);
 
     g_signal_connect (config, "value-changed",
             G_CALLBACK(ibus_config_value_changed), arrayeng);
@@ -336,7 +338,8 @@
                                      text,
                                      array_preedit->len, //arrayeng->cursor_pos,
                                      TRUE);
-    g_object_unref (text);
+    if (G_IS_OBJECT (text) && g_object_is_floating (text))
+    	g_object_unref (text);
 
     g_string_free(array_preedit, TRUE);
 }
@@ -430,7 +433,8 @@
     IBusText *text;
     text = ibus_text_new_from_static_string (string);
     ibus_engine_commit_text ((IBusEngine *)arrayeng, text);
-    g_object_unref (text);
+    if (g_object_is_floating (text))
+    	g_object_unref (text);
 }
 
 static void
@@ -669,7 +673,9 @@
     if (aux_string) {
         text = ibus_text_new_from_string(aux_string);
         ibus_engine_update_auxiliary_text((IBusEngine*)arrayeng, text, TRUE);
-        g_object_unref(text);
+
+    if (g_object_is_floating (text))
+        g_object_unref (text);
     }
 }
 
