Fixed lib.clone infinite loop bug