simplify NULL check
add top-level instance ID