Fixed a cherry-pick problem from Master for a deadlock