better error messaging for heap walks

also some cleanup for heap walk internal functionality