fixed some bugs in compute_mean_time_course.m