Improvement of the session building (some issues fixed #66, #45)