why do you retern UINT32 from write function? You never use it.