diff --git a/restws.module b/restws.module
index 15ba327..ff6bc94 100644
--- a/restws.module
+++ b/restws.module
@@ -198,12 +198,18 @@ function restws_menu_alter(&$items) {
     if (isset($items[$menu_path])) {
       // Prepend the page callback and the resource to the page arguments.
       // So we can re-use it on standard HTML page requests.
+      if (!isset($items[$menu_path]['page arguments'])) {
+        $items[$menu_path]['page arguments'] = array();
+      }
       array_unshift($items[$menu_path]['page arguments'], $resource, $items[$menu_path]['page callback']);
       $items[$menu_path]['page callback'] = 'restws_page_callback';
     }
     // Also replace wildcard loaders (e.g. node/%node)
     elseif (isset($items[$menu_path . $resource])) {
       $menu_path = $menu_path . $resource;
+      if (!isset($items[$menu_path]['page arguments'])) {
+        $items[$menu_path]['page arguments'] = array();
+      }
       array_unshift($items[$menu_path]['page arguments'], $resource, $items[$menu_path]['page callback']);
       $items[$menu_path]['page callback'] = 'restws_page_callback';
     }
