utils.c: fix crash with threading enabled.