tweaked array copy operations to be more efficient