patch for ratio and fix legend