alright so it compiles but now is giving segmentation fault