fix potential buffer overflow in HITAG2. implement HITAG1 write.