seg fault caused by text file