Changed main.cxx to avoid segfault.

I don't know why segfault causes. If you know why, please post the reason to the issue.
I always welcome your opinion.
Merge branch 'hyamamoto' into dev