some code cleanup, testing redesing of handling session, try to fix bug #31