Found that if lag is greater than 100, a segmentation fault occurs