Minor change to accept both of file pointer and filename