Added check for connected session