fix children reference access before defined