Better error handling for activity state