Add csv namelist and fix some bugs