improve $mode