Adding hasActivity() check.