Added a check for a BIO error