serialize and deserialize BT