Fix errors when no Activity is available