Fixed BT handshake code