fix weight for data and deal with one-file samples