Detecting error strings more reliably