Fix fatal error when space deactivates

Also assure that no custom_theme is triggered.
Related #2284