Index: t3lib/class.t3lib_tstemplate.php =================================================================== --- t3lib/class.t3lib_tstemplate.php (revision 8735) +++ t3lib/class.t3lib_tstemplate.php (working copy) @@ -499,7 +499,7 @@ $addC=' AND uid='.intval($start_template_uid); } - $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_template', 'pid='.intval($this->absoluteRootLine[$a]['uid']).$addC.' '.$this->whereClause,'','sorting',1); + $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_template', 'pid=' . intval($this->absoluteRootLine[$a]['uid']) . $addC . ' ' . $this->whereClause, '', 'root DESC, sorting', 1); if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { $this->versionOL($row); if (is_array($row)) {