writing metadata hex fix