Fix background and theme detection