deep copy output to prevent side-effect