fix allocate data bugs