fix possible dereference of null pointer