Fix ClassCastException on deserialising characters