catch IO errors with ValueError