Bugfix for #271

Corrected issue #271 which led to a compilation error if the heat
exchanger and the tank had different media.