Tentative fix for clone function; needs more testing.