fix for null dereference in obscure case