fix some labeling and abolish global variable