use intbyreference instead of buffer