Activity lifecycle fix