Correctly get the the raw pointer

There was a typo too
Add missing counter
Use parents unique id