Avoid shallow copies of array and hash + test