AI-843 : fixed potential ClassCastException