Fix segmentation fault + if statement removed