Fixed incorrect scope on a null reference guard