Clone constructor function to avoid reference