checking for error condition