fix free
refine logging