fixing offset.un may be used uninitialized in this function