Fix type conversion error breaking large files