fixed bug relating to switching back to MainActivity and a bug with tab
switching.