Found a code snippet that fixes the back button problem.