Merge "Fix a race condition in BT device handling"