updated writehexstring