fixed deadlock with replica exchange and -maxh

Fixes #1273

Change-Id: Ib93cce59adf60afe0971944ef41df3a7d9883edc