trying to debug the seg fault