Make defaultValue more tolerant of bad values