Added apdu serialization functions