added routine to copy slice