add write func in ctf loader