Fix memory issues.