fix a momery leaks