added ref to parent/child and fixed cycle bugs