resolve seg fault issue