Improved URL handling and other fixes

If you load the page with a session id included in the URL, this line will append it again. For example.
URL: http://localhost:8080/#test, Send link to a friend: http://localhost:8080/#test#test