fix array cloning bug