detect nullable types and call nullify in toStruct