better error messages for threads