diff --git a/autologout.install b/autologout.install
index 0356640..295c6af 100644
--- a/autologout.install
+++ b/autologout.install
@@ -11,11 +11,11 @@
  * Implementation of hook_install().
  */
 function autologout_install() {
-  // Create tables.
-  drupal_install_schema('autologout');
-  
   // sink module's weight to the deepest depths of the module_list()
-  db_query("UPDATE {system} SET weight = %d WHERE name = '%s'", 1000, 'autologout');
+  db_query("UPDATE {system} SET weight = :weight WHERE name = ':name", array(
+    ':weight' => 1000,
+    ':name' => 'autologout',
+  ));
 }
 
 
@@ -23,9 +23,6 @@ function autologout_install() {
  * Implementation of hook_uninstall().
  */
 function autologout_uninstall() {
-  // Remove table.
-  drupal_uninstall_schema('autologout');
-
   variable_del('autologout');
   variable_del('autologout_one_session');
 }
diff --git a/autologout.module b/autologout.module
index 869da94..f99cfe0 100644
--- a/autologout.module
+++ b/autologout.module
@@ -559,7 +559,7 @@ function _autologout_user_logout_setting($uid) {
         {autologout}
     ";
     $result = db_query($sql);
-    while ($row = db_fetch_object($result)) {
+    foreach ($result as $record) {
       $user_settings[$row->uid] = $row->setting;
     }
   }
