fixing segfault on Linux
adding script for debug build.
somehow replacing puts() with fprintf() fix the strange appending string problem