fixed some unexpected copying