fix type errors and missing memcpy for seq_num