fixed bugs: empty input or comment, and exit possibly