Fixed the bugs in application codes. They count the last data point from a data file or STDIN doubly.