improved performance of callback function in mean-field master equation example