Improved session handling on server side