change: prevent memory double free.
fix: some comments and indentation.