fix detecting when a merge is needed.