That code wasn't intended to fix any problems, just check to see if session management where working correctly be displaying the session ID on the page, if the session ID is not the same when you visit each page, the session contents wont be kept.
When I visit you page, I am not able to reproduce a problem, I add an item to the page and the cart page displays the item I just added.
Do you have cookies enabled in your browser? Can you try on another computer? Or in another browser?