Cleanup.
Use substring to test error.

Sometimes the error report is too long.