fix wrong length for newArray