better heartbeat handling