deep copy function to help creating many solutions