Fix for ClassCastException on NullableWrapper writing