fix race conditions when inserting new child or parent uids