Merge change 4834 into donut

* changes:
  Fix a bug where wrong variable was used for comparison.