pointed out the cause of the segfault