fixing bugs in CSR