patch to theme.php, copied from Robelix's patch 674719