fix reference vs clone bug