Fix compare of reference with NULL object