Add casts for big endian machines