Solves the segmentation fault bug.