Added ROOTDIR constant, fixed session saving in some environments