Fixed an error checking issue in the io implementation.