Possible fix for ClassCastException.