Fix a ClassCastException