Fixed bug when adata length is 0