Fix bugs in native cloning