Fixed bug when back button is pressed.