re-added session validity check