Fixed seg fault issue