added condition to addParent operation + test