add res null condition