Fix handling of empty optional fields.