Fix output path.

Now exactly aligned with the old one.
Fix some compile bugs.