OO-3469: better check variable in velocity template, check if the candidate session exists in disposing phase