Handle invalid/empty values

Invalid values are converted to the zero value, e.g. when attempting to
read an integer, "foo" becomes 0.