fix #146, touching file pointer without checking if valid