fixing I/O exceptions

Signed-off-by: Ajeet Jha <ajeetjha1@gmail.com>