Minor bug fixes when switching between activities