Added more robust method for setting the section displayed in the navigation bar