Fix session id generation.
Updates history
Updates history