callback for back navigation
further improved the navigator