Tweaks to avoid deadlocking