fix endianness issue with addpattern