Change sublength to 32 bits. Someone might have more than (sizeof(Friends) / 65536) friends...