fix the I/O exception

I add some exception handler to the I/O operation