Issue #783: python3 compatible - fixed error message checking.