Fix heartbeat bug