fixed memoery issue