found seg fault but cant fix it