IDEX-1759: avoid ClassCastException