fixed undefined if back button is pressed