Fix bug 2716, bad file pointer