Bug Fixed when copying state values for objects