verify non-NULL before dereferencing