Index: mythweb/modules/tv/classes/Program.php
===================================================================
--- mythweb/modules/tv/classes/Program.php	(revision 22901)
+++ mythweb/modules/tv/classes/Program.php	(working copy)
@@ -703,9 +703,9 @@
                                 .escape($this->category)                  .','
                                 .escape($this->seriesid)                  .','
                                 .escape($this->programid)                 .','
-                                .escape($this->recordid)                  .','
+                                .escape(isset($this->recordid) ? $this->recordid : 0)                  .','
                                 .escape($this->channel->callsign)         .','
-                                .escape($this->rectype)                   .','
+                                .escape(isset($this->rectype) ? $this->rectype : 0)                   .','
                                 .'11'                                     .','
                                 .'1'                                      .')')
             or trigger_error('SQL Error: '.mysql_error(), FATAL);
Index: mythweb/modules/mythtv/set_keys.php
===================================================================
--- mythweb/modules/mythtv/set_keys.php	(revision 22901)
+++ mythweb/modules/mythtv/set_keys.php	(working copy)
@@ -75,7 +75,7 @@
     $sh = $db->query('SELECT *
                         FROM keybindings
                        WHERE hostname = ?
-                    ORDER BY (context = "Global") DESC, context',
+                    ORDER BY (context = "Global") DESC, context, action',
                      $_SESSION['settings']['host']);
     while ($row = $sh->fetch_assoc()) {
         $Keys[] = $row;
