Better deadlock fixing