backported session fix from pull request #1898 to stable 45 to fix #1049
Merge pull request #2154 from owncloud/backport1898

backported session fix from pull request #1898 to stable 45 to fix #1049