count_line function change