changed gapbuffer getdata to use length instead of second index