some fixes in session and history