fields ending comma bug fixed