added big little endian support