implemented arraycopy