avoid dereferencing NULL