Fixed segfault in events matrix. Made code for csc study.