Fixing a potential bug in the theme detection