ClassCastException handling