trying to figure out the seg fault