Fix many warnings.
Merge pull request #1409 from namusyaka/cleanup-warnings

Fix many warnings.