Fix bug with .cast forcing bad values to NA, not NM.