Motoko Trie.mapFilter on IC Canister

I have a piece of code that uses Motoko Trie.mapFilter. It works fine in local canister and IC canister (our dev env) but it didn’t work (returning empty result) in our IC canister for production env. We ended up using Array.mapFilter by first converting Trie to Array. It works fine now in all canisters.

Here is the code using Trie.mapFilter:

public func findBrandBasicByIdArray(users : Trie.Trie<UserId, UserModel>, userIdArray: [UserId]) : [BrandBasic] {
    let brandBasicTrie = Trie.mapFilter<UserId, UserModel, BrandBasic>(users, func (key, value) : ?BrandBasic {
      let found = Array.find<UserId>(userIdArray, func (userId) : Bool {
        userId == value.userId;
      });

      switch found {
        case null null;
        case (?myUser) ?{ userId=value.userId; brand=value.brand; profileImageId=value.profileImageId };
      };
    });

    Trie.toArray<UserId, BrandBasic, BrandBasic>(brandBasicTrie, func (key, value) : BrandBasic {
      value;
    });
  };

Here is the code using Array.mapFilter:

public func findBrandBasicByIdArray(users : Trie.Trie<UserId, UserModel>, userIdArray: [UserId]) : [BrandBasic] {
    let userArray = Trie.toArray<UserId, UserModel, UserModel>(users, func (key, value) : UserModel {
      value;
    });

    Array.mapFilter<UserModel, BrandBasic>(userArray, func (value) : ?BrandBasic {
      let found = Array.find<UserId>(userIdArray, func (userId) : Bool {
        userId == value.userId;
      });

      switch found {
        case null null;
        case (?myUser) ?{ userId=value.userId; brand=value.brand; profileImageId=value.profileImageId };
      };
    });
  };

The MOC compiler is also upgraded from 0.6.5 to 0.6.15 around the time we have production deployment. Could it be related?

Has anyone come across the issue?

It is not show-stopper issue but it would be good to know the root problem.

Thanks.