Fix error where heartbeats were being reset to undefined.

Fixes #2426.