Improved the handling of theme pages