Fix ClassCastException.