Fix header install path.
Fix some minor issue, and a memory leak.