Merge change 3485

* changes:
  Fix build issue and ref count bug with scripts.