Arduino can't write return values of functions to serial

I am having a strange issue, where I send fata between my pc and arduino, and the returned data is garbage, I did make an ECHO command to check if the data I send gets back too - sometimes it does not. What’s more strange: When sending direct values (constants) everything works but when sending return values then arduino can only send one, the others will get 0xBAADF00D or something set when reading the values on my pc.

The code I use:

	#if defined WIN32
	#define ARDUINO_INTEGER short
	#else
	#define ARDUINO_INTEGER int
	#endif
	struct Packet
	{
	private:
		char data[7];
		ARDUINO_INTEGER tmpint;
	public:
		Packet()
		{
			data[0] = starter;
			data[6] = terminator;
		}
		Packet(const char action, ARDUINO_INTEGER value_one, ARDUINO_INTEGER value_two)
		{
			set(action, value_one, value_two);
		}
		Packet(const char action, char byte_a, char byte_b, char byte_c, char byte_d)
		{
			set(action, byte_a, byte_b, byte_c, byte_d);
		}
		void set(const char action, ARDUINO_INTEGER value_one, ARDUINO_INTEGER value_two)
		{
			data[0] = starter;
			data[1] = action;
			memcpy(&data[2], &value_one, 2);
			memcpy(&data[4], &value_two, 2);
			data[6] = terminator;
		}
		void set(const char action, char byte_a, char byte_b, char byte_c, char byte_d)
		{
			data[0] = starter;
			data[1] = action;
			data[2] = byte_a;
			data[3] = byte_b;
			data[4] = byte_c;
			data[5] = byte_d;
			data[6] = terminator;
		}
		void set(char * _data, size_t datasize = 7)
		{
			if (datasize > 7)
				datasize = 7;
			for (size_t i = 0; i < datasize; ++i)
			{
				data[i] = _data[i];
			}
		}
		ARDUINO_INTEGER GetValueOne()
		{
			//copy to data[2] and data[3]
			memcpy(&tmpint, &data[2], 2);
			return tmpint;
		}
		ARDUINO_INTEGER GetValueTwo()
		{
			//copy to data[4] and data[5]
			memcpy(&tmpint, &data[4], 2);
			return tmpint;
		}
		const char GetAction()
		{
			return data[1];
		}
		char GetB1()
		{
			return data[2];
		}
		char GetB2()
		{
			return data[3];
		}
		char GetB3()
		{
			return data[4];
		}
		char GetB4()
		{
			return data[5];
		}
		bool valid()
		{
			return (data[0] == starter && data[6] == terminator);
		}
		char * get()
		{
			return &data[0];
		}
		size_t size()
		{
			return 7;
		}
		void Send()
		{
			delay(10);
			Serial.write((uint8_t*)data,7);
		}
	};

	Packet universal;

	int three = 3;
	int five = 5;
	int two = 2;

	int SomeFunc()
	{
		int result = (five + five + three - three) / two;
		return result;
	}

	void setup()
	{
		Serial.begin(115200);
	}

	void loop()
	{
		//receive some data and send back some data, then periodically do this:
		universal.set(echo_data, SomeFunc(), SomeFunc());
		universal.Send();
	}

Now, when I change universal.set(echo_data, SomeFunc(), SomeFunc()); to universal.set(echo_data, 12345, 6789);

… it works. Why?

also, when sending data back and forth really fast, some data from the arduino does not get to my PC?

eg:

universal.set(echo_data, 1111, 2222);
universal.Send();
universal.set(echo_data, 3333, 4444);
universal.Send();

the 3333,4444 most of the time is not send when removing the Delay(10), when adding the delay(10) it still occurs but less…
i can protect myself from “garbage” data but I cannot do anything about data that has not been send, please help.