fixed the bug that generated wrong rows combination.