avoid dereferencing another NULL pointer