fix #1, memory leak when input from console