fix clone function