Crashing SEGFAULT but corrected