Fixed heartbeat bug