--- translation_overview.module.orig	2008-10-23 03:51:12.000000000 +0200
+++ translation_overview.module	2008-12-24 00:27:45.000000000 +0100
@@ -129,6 +129,10 @@
       $form['#submit'][] = 'translation_overview_schema_remove_submit';
       break;
 
+    case 'locale_languages_overview_form':
+      $form['#submit'][] = 'translation_overview_schema_overview_submit';
+      break;
+
     case 'locale_languages_predefined_form':
     case 'locale_languages_custom_form':
       $form['#submit'][] = 'translation_overview_schema_add_submit';
@@ -267,7 +271,7 @@
     return theme('translation_overview_translation_link', 'original', $link, $properties);
   }
   // Determine the status of the translation.
-  if ($translation_node->nid) {
+  if (!empty($translation_node->nid)) {
     $properties['has_note'] = !empty($translation_node->field_translator_note[0]['value']);
     if (node_access('update', $translation_node)) {
       $link['path'] = "node/$translation_node->nid/edit";
@@ -359,10 +363,9 @@
 }
 
 /**
- * Alter the schema when new languages are added.
+ * Helper function: add database table column if non-existant.
  */
-function translation_overview_schema_add_submit($form, &$form_state) {
-  $fieldname = db_escape_table($form_state['values']['langcode']);
+function _translation_overview_schema_add_column($fieldname) {
   if (!db_column_exists('translation_overview_priority', $fieldname)) {
     $ret = array();
     $field = array(
@@ -381,6 +384,24 @@
 }
 
 /**
+ * Add columns for languages being enabled which were added
+ * when translation_overview was not active.
+ */
+function translation_overview_schema_overview_submit($form, &$form_state) {
+  foreach ($form_state['values']['enabled'] as $langcode => $value) {
+    _translation_overview_schema_add_column(db_escape_table($langcode));
+  }
+}
+
+/**
+ * Alter the schema when new languages are added.
+ */
+function translation_overview_schema_add_submit($form, &$form_state) {
+  $fieldname = db_escape_table($form_state['values']['langcode']);
+  _translation_overview_schema_add_column($fieldname);
+}
+
+/**
  * Alter the schema when languages are removed.
  */
 function translation_overview_schema_remove_submit($form, &$form_state) {
