Fix file pointer mess up.