session handling cleanup
Merge origin/master