Fix clone bug and Add test of control flow