fix bug in cloning