added swap_endian