make isdefined not throw an error for nonexistent fields or indexes.
fixes #3826