unified create and write fields
fixed compile error