Fix back button behavior when rotating the device