Fixed wrong Exception being thrown

This schould be an IOException
Merge pull request #322 from siad007/patch-3

Fixed wrong Exception being thrown