avoid writing undefined values