fixed cloning logic