Handle multiple activities correctly.