fixed problems with different index start in c and r