fix possible null dereference