fix a bug when free structure