work around problems with the libpthread onexit() handler