add debug code
refine row processing