tried fixing the seg fault issues