fixing a bug in session initilization