Fixed several issues with websocket heartbeat