bug fix in data allocation