fix some issues with sessions. Remove some useless code