Replaced non-thread-safe error-reporting routines.