Adding a couple of checks to make sure we don't try to load an invalid theme object.