prevent error during top term reset
moved node reset logic to a separate function
add TODO