omit undefined fields and rectify types