fixed bug storing wrong length of data

Signed-off-by: tanji <nicholastanjerome@gmail.com>