modified _generate to skip values for keys where the value === undefined