core: Guard against deadlock