Fix the bug of wrong cprStartIndex and Add more testcases