A device for providing a gas composition and temperature compensated acoustic measurement of the level of a liquid in a tank , comprising: a transmitter adapted to transmit acoustic signals; a receiver adapted to receive reflections of said acoustic signals; a processing circuitry connected to the transmitter and the receiver and adapted to determine the level of the liquid based on the transmitted acoustic signals and the received reflections of the acoustic signals; a waveguide for guiding acoustic signals from the transmitter to the liquid level surface and for guiding reflections of the acoustic signals back to the receiver, the waveguide comprising - a first end connected to the transmitter, - a second end extending into the liquid, - a reference portion above the liquid surface for allowing said processing circuitry to determine a reference speed of sound and said reference portion further comprises a bottom surface intended to face the liquid level surface during operation, and a top surface intended to face away from the liquid level surface during operation, a retaining chamber for at least temporarily retaining liquid, at least one inlet forming a fluid connection between the retaining chamber and the reference portion , and said at least one inlet is arranged at the bottom surface, an absorbing element arranged in the retaining chamber and adapted to collect liquid originating from the liquid in the tank and to release gas originating from said liquid through the inlet(s) into the reference portion , and characterized in that an outlet formed in the reference portion closer to the first end than said at least one inlet and said outlet is arranged at the top surface. a transmitter adapted to transmit acoustic signals; a receiver adapted to receive reflections of said acoustic signals; a processing circuitry connected to the transmitter and the receiver and adapted to determine the level of the liquid based on the transmitted acoustic signals and the received reflections of the acoustic signals; a waveguide for guiding acoustic signals from the transmitter to the liquid level surface and for guiding reflections of the acoustic signals back to the receiver, the waveguide comprising - a first end connected to the transmitter, - a second end extending into the liquid, - a reference portion above the liquid surface for allowing said processing circuitry to determine a reference speed of sound and said reference portion further comprises a bottom surface intended to face the liquid level surface during operation, and a top surface intended to face away from the liquid level surface during operation, - a first end connected to the transmitter, - a second end extending into the liquid, - a reference portion above the liquid surface for allowing said processing circuitry to determine a reference speed of sound and said reference portion further comprises a bottom surface intended to face the liquid level surface during operation, and a top surface intended to face away from the liquid level surface during operation, a retaining chamber for at least temporarily retaining liquid, at least one inlet forming a fluid connection between the retaining chamber and the reference portion , and said at least one inlet is arranged at the bottom surface, an absorbing element arranged in the retaining chamber and adapted to collect liquid originating from the liquid in the tank and to release gas originating from said liquid through the inlet(s) into the reference portion , and characterized in that an outlet formed in the reference portion closer to the first end than said at least one inlet and said outlet is arranged at the top surface. <EOS>