ensure parent id's are set