fixed mistake in handling of heartbeats