Index: units/categories/categories_event_handler.php
===================================================================
--- units/categories/categories_event_handler.php	(revision 13919)
+++ units/categories/categories_event_handler.php	(working copy)
@@ -1515,7 +1515,17 @@
 				}
 			}
 			else {
-				$real_t = $this->_getDefaultDesign();
+				$not_found = $this->Application->ConfigValue('ErrorTemplate');
+				$real_t = $not_found ? $not_found : 'error_notfound';
+
+				$themes_helper =& $this->Application->recallObject('ThemesHelper');
+				/* @var $themes_helper kThemesHelper */
+
+				$theme_id = $this->Application->GetVar('m_theme');
+				$category_id = $themes_helper->getPageByTemplate($real_t, $theme_id);
+				$this->Application->SetVar('m_cat_id', $category_id);
+
+				header('HTTP/1.0 404 Not Found');
 			}
 
 			// replace alias in form #alias_name# to actual template used in this theme
